From 3586596b0f8f5bf1cd4cc5cc24b45f6a80e2e2e8 Mon Sep 17 00:00:00 2001 From: "cl349@firebug.cl.cam.ac.uk" Date: Tue, 6 Sep 2005 18:15:06 +0000 Subject: [PATCH] Add @releaseDomain watch-event. Signed-off-by: Christian Limpach --- tools/xenstore/xenstored_domain.c | 8 ++++++++ tools/xenstore/xenstored_watch.c | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c index 62c30fa1fa..34278ad902 100644 --- a/tools/xenstore/xenstored_domain.c +++ b/tools/xenstore/xenstored_domain.c @@ -360,6 +360,9 @@ void do_release(struct connection *conn, const char *domid_str) } talloc_free(domain->conn); + + fire_watches(NULL, "@releaseDomain", false); + send_ack(conn, XS_RELEASE); } @@ -367,6 +370,7 @@ void domain_cleanup(void) { xc_dominfo_t dominfo; struct domain *domain, *tmp; + int released = 0; list_for_each_entry_safe(domain, tmp, &domains, list) { if (xc_domain_getinfo(*xc_handle, domain->domid, 1, @@ -375,7 +379,11 @@ void domain_cleanup(void) !dominfo.dying && !dominfo.crashed && !dominfo.shutdown) continue; talloc_free(domain->conn); + released++; } + + if (released) + fire_watches(NULL, "@releaseDomain", false); } void do_get_domain_path(struct connection *conn, const char *domid_str) diff --git a/tools/xenstore/xenstored_watch.c b/tools/xenstore/xenstored_watch.c index 804a386868..ebd13111d5 100644 --- a/tools/xenstore/xenstored_watch.c +++ b/tools/xenstore/xenstored_watch.c @@ -132,7 +132,7 @@ void fire_watches(struct connection *conn, const char *node, bool recurse) struct watch *watch; /* During transactions, don't fire watches. */ - if (conn->transaction) + if (conn && conn->transaction) return; /* Create an event for each watch. Don't send to self. */ -- 2.30.2